package com.desksoft.ecommerce.util.html.view.print;

import java.util.ArrayList;
import java.util.List;

import org.dom4j.Element;

import com.desksoft.ecommerce.util.html.element.PageElement;
import com.desksoft.ecommerce.util.html.view.print.dynamictemplate.DynamicTemplateElement;

/**
 * 打印元素配置
 * @author Administrator
 *
 */
public class PrintElement extends PageElement {

	protected List<DynamicTemplateElement> dynamicTemplateList;

	public PrintElement(Element elmtPrint) {
		super();
		Element elmtDynamicTamplate = elmtPrint.element("dynamic-template");
		if (elmtDynamicTamplate != null){
			parseDynamicElement(elmtDynamicTamplate);
		}
	}
	
	public PrintElement() {
		super();
	}

	/**
	 * 解析动态模版列表
	 */
	public void parseDynamicElement(Element elmt){
		
		List<Element> elmtL = elmt.elements("dynamic");
		
		dynamicTemplateList = new ArrayList<DynamicTemplateElement>(elmtL.size());
		for (Element elmtDynamic : elmtL){
			dynamicTemplateList.add(new DynamicTemplateElement(elmtDynamic));
		}
	}

	public List<DynamicTemplateElement> getDynamicTemplateList() {
		return dynamicTemplateList;
	}

	public void setDynamicTemplateList(
			List<DynamicTemplateElement> dynamicTemplateList) {
		this.dynamicTemplateList = dynamicTemplateList;
	}
	
	
}
